package top.wshape1.rpc.consumer;

import io.netty.util.concurrent.Promise;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Wshape1
 * @version 1.0
 * @description
 * @since 2024-02-02
 */

public class CallFutureHolder {

    // 等待响应的Promise
    private static final Map<Integer, Promise<Object>> PROMISE_MAP = new HashMap<>();

    public static void put(int sequenceId, Promise<Object> promise) {
        PROMISE_MAP.put(sequenceId, promise);
    }

    public static Promise<Object> remove(int sequenceId) {
        return PROMISE_MAP.remove(sequenceId);
    }

}
